DialogType =
{
    None = 0,
    Nomal = 1,
    Single = 2,
}

---@class DialogBaseView : IBaseView
---@field protected behaviour DialogBasePanel
local this = BaseClass("DialogBaseView", IBaseView)

---@param args ObjData
function this:SetData(args)
    self.data = args
end

---@param obj UnityEngine.GameObject
function this:Awake(obj)
    self.super.Awake(self, obj)
    self.dialogTxts = {}; self.dialogBtnPos = nil
    table.insert(self.dialogTxts, self.behaviour.Dialog1_txt)
    table.insert(self.dialogTxts, self.behaviour.Dialog2_txt)
    self.dialogBtnPos = LuaHelper.GetLocalPos(self.behaviour.Dialog1_obj)
end

function this:Open()
    self.super.Open(self)
    local item = TableDataMgr.GlobalDialogMgr:GetItemByKey(self.data.objId)
    if (item == nil)then return; end

    for i = 1, #item.BtnName do
        if (i <= #self.dialogTxts)then
            self.behaviour.dialogTxts[i].text = LuaHelper.GetStringByID(item.BtnName[i])
        end
    end

    self.behaviour.Tip_txt.text = LuaHelper.GetStringByID(item.Title)
    self.behaviour.Info_txt.text = LuaHelper.GetStringByID(item.ContentId, self.data.strArg)
    LuaHelper.SetActive(self.behaviour.Close_obj, item.TapClose)

    if (item.TipType == DialogType.Nomal)then
        LuaHelper.SetLocalPos(self.behaviour.Dialog1_obj, self.dialogBtnPos)
        LuaHelper.SetActive(self.behaviour.Dialog2_obj, true)
    elseif(item.TipType == DialogType.Single)then
        LuaHelper.SetLocalTrans(self.behaviour.Dialog2_obj, ETransType.Pos, EDirectType.X, 0)
        LuaHelper.SetActive(self.behaviour.Dialog2_obj, false)
    else
        LuaHelper.SetLocalPos(self.behaviour.Dialog1_obj, self.dialogBtnPos)
        LuaHelper.SetActive(self.behaviour.Dialog1_obj, false)
        LuaHelper.SetActive(self.behaviour.Dialog2_obj, false)
    end
end

function this:Destroy()
    self.dialogTxts = nil
    self.dialogBtnPos = nil
    self.super.Destroy(self)
end

DialogBaseView = this